package cn.lbd.kill.model.mapper;

import cn.lbd.kill.model.entity.Item;
import cn.lbd.kill.model.entity.ItemKill;
import cn.lbd.kill.model.entity.ItemKillExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface ItemKillMapper {
    long countByExample(ItemKillExample example);

    int deleteByExample(ItemKillExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(ItemKill record);

    int insertSelective(ItemKill record);

    List<ItemKill> selectByExample(ItemKillExample example);

    ItemKill selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") ItemKill record, @Param("example") ItemKillExample example);

    int updateByExample(@Param("record") ItemKill record, @Param("example") ItemKillExample example);

    int updateByPrimaryKeySelective(ItemKill record);

    int updateByPrimaryKey(ItemKill record);

    int batchUpdate(@Param("recordList") List<ItemKill> recordList);

    int batchInsert(@Param("recordList") List<ItemKill> recordList);

    int batchDelete(@Param("ids") Integer[] ids);

    //获取所有待秒杀商品并包含canKill字段
    List<ItemKill> getKillItems();

    //根据秒杀ID获取待秒杀商品，并包含canKill字段
    ItemKill getKillItemsInfo(Integer id);

    //库存减一
    int updateTotalCount(Integer id);
}